# -*- coding: utf-8 -*-
# 读写2003 excel
import xlrd
import re
workbook = xlrd.open_workbook("F:\\资源修改书单隐藏后.xls")
table=workbook.sheet_by_name('列表图片')
nrows=table.nrows
for i in range(nrows):
  csql="update resource set "
  row = table.row_values(i)
  if i<1:
    print("-- ----------Sheet1-")
  else:
    j=0;
    resource_id ='';
    pic_url ='';
    is_delete ='';
    for cell in row:
      cell=str(cell).replace("\n", "").replace("\r","").replace("\u200B","").replace("http://resource.helloprincess62.top","").strip()
      if j==0:
        resource_id=cell
      if j==3:
        pic_url=cell
      if j==4:
        is_delete=cell[0:len(cell)-2]

      j=j+1;
    if(len(resource_id)>0 and len(pic_url)>0):
      print(csql  + " `pic_url`= '"+ pic_url +"' where `resource_id`= '"+resource_id+"';")
    # elif(len(resource_id)>0 and len(is_delete)>0):
    #   print(csql  + " `is_delete`= '"+ is_delete +"' where `resource_id`= '"+resource_id+"';")
  i=i+1

